import request from '@/utils/request'

//获取采购计划统计
export function purchaseStateTount() {
  return request({
    url:'/purchasePlan/getJobStateCount',
    method: 'get'  
  })
}
//采购计划列表
export function purchaseList(data) {
    return request({
      url:'/purchasePlan/find',
      method: 'post',
      data
    })
}
//创建物资采购计划
export function purchaseSave(data) {
    return request({
      url:'/purchasePlan/create',
      method: 'post',
      data
    })
}
//修改物资采购计划
export function purchaseEdit(data) {
    return request({
      url:'/purchasePlan/update',
      method: 'post',
      data
    })
}
//驳回以后  重新发起采购计划  
export function purchaseApplyAgain(data) {
  return request({
    url:'/purchasePlan/applyAgain',
    method: 'post',
    data
  })
}
//物资批量驳回
export function purchaseMaterialRejectBatch(data) {
    return request({
      url:`/purchasePlan/rejectBatchGoods`,
      method: 'post',
      data
    })
}


//批量删除物资采购计划
export function purchaseDelBatch(ids) {
    return request({
      url:`/purchasePlan/delBatch?ids=${ids}`,
      method: 'get'
    })
}
//删除物资采购计划
export function purchaseDel(id) {
    return request({
      url: `/purchasePlan/del/${id}`,
      method: 'post'
    })
}

//修改或添加物资
export function purchaseSaveMaterial(data) {
    return request({
      url:'/purchasePlan/saveGoods',
      method: 'post',
      isTrue:true,
      data
    })
}
//根据状态--获取处理人列表
export function purchaseApplyUser(stateId) {
    return request({
        url:`/purchasePlan/getHandleUserListByState?stateId=${stateId}`,
        method: 'get'
    })
}
// 审批明细
export function purchaseApplyLog(planId) {
    return request({
        url:`/purchasePlan/getOpLog?planId=${planId}`,
        method: 'get'
    })
}
// 查询驳回物资
export function purchaseApplyMaterial(planId) {
    return request({
        url:`/purchasePlan/getPlanGoods?planId=${planId}`,
        method: 'get'
    })
}
//采购计划通过
export function purchaseSuccess(data) {
    return request({
      url:'/purchasePlan/pass',
      method: 'post',
      data
    })
}
//采购计划步骤流转
export function purchaseReject(data) {
    return request({
      url:'/purchasePlan/reject',
      method: 'post',
      data
    })
}


/**-----------------------------------------------------------------------------待发起采购 ---------------------------------------------------------*/
//待发起列表
export function bidPurchaseList(data) {
  return request({
    url:'/bid/findGoodsPager',
    method: 'post',
    data
  })
}
//发起招标
export function bidPurchaseCreate(data) {
  return request({
    url:'/bid/createBid',
    method: 'post',
    data
  })
}




/*--------------------------------------------------询价采购 */

export function bidPurchaseCommonList(data) {
  return request({
    url:'/bid/findBidPager',
    method: 'post',
    data
  })
}

//供应商报价
export function bidPurchaseSupplierQuote(data) {
  return request({
    url:'/bid/createQuote',
    method: 'post',
    data
  })
}
//供应商取消报价
export function bidPurchaseSupplierCancelQuote(id) {
  return request({
      url:`/bid/cancelQuote/${id}`,
      method: 'get'
  })
}
//中标公示
export function bidPurchaseOvert(id,gsFlag) {//gsFlag 是否公示  1公示 0不公示 2撤回
  return request({
      url:`/bid/bidPublicity/${id}/${gsFlag}`,
      method: 'get'
  })
}
//终止
export function bidPurchaseStop(id) {
  return request({
      url:`/bid/close/${id}`,
      method: 'get'
  })
}
//详情
export function bidPurchaseDetails(id) {
  return request({
      url:`/bid/detail/${id}`,
      method: 'get'
  })
}
//删除
export function bidPurchaseDel(id) {
  return request({
      url:`/bid/del/${id}`,
      method: 'get'
  })
}

/*-------------------------------------------------邀请采购  */

//供应商报名 专家评分
export function bidPurchaseInvitationSupplierEnroll(data) {
  return request({
    url:'/bid/score',
    method: 'post',
    data
  })
}

//审核通过
export function bidPurchaseInquiryInvitationSetWinSupplier(data) {
  return request({
    url:'/bid/setWinSupplier',
    method: 'post',
    data
  })
}
//询价报名-邀请报名-公告报名明细
export function bidPurchaseInquiryInvitationEnrollDetails(id) {
  return request({
      url:`/bid/getQuoteDetail/${id}`,
      method: 'get'
  })
}
//询价--评审不通过 进入流标
export function bidPurchaseInquiryInvitationCancel(data) {
  return request({
      url:'/bid/cancel',
      method: 'post',
      data
  })
}
//分配专家提交
export function bidPurchaseRoleIdUserSave(data) {
  return request({
      url:'/bid/selectExpertIds',
      method: 'post',
      data
  })
}